#include<stdio.h>
int main()
{
	int t,i,j;
	scanf("%d",&t);
	for(i=1;i<=t;i++)
	{
		int n;
		int a[99999];
		int b=0,c=0;
		scanf("%d",&n); 
		for(j=0;j<n;j++)
		{
			scanf("%d",&a[j]);
				if(j==0)
				{
					b=a[0]*6+5; 
					continue;
				}
				if(a[j]<a[j-1])
				{
					c+=(a[j-1]-a[j])*4+5;
					continue;
				}
				if(a[j]>a[j-1])
				{
					b+=(a[j]-a[j-1])*6+5;
					continue;
				}
				
			
		}
		int time=b+c;
		printf("%d\n",time);
	}
	return 0;
 } 
